# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Analytics.V3.Model.Goal do
  @moduledoc """
  JSON template for Analytics goal resource.

  ## Attributes

  *   `accountId` (*type:* `String.t`, *default:* `nil`) - Account ID to which this goal belongs.
  *   `active` (*type:* `boolean()`, *default:* `nil`) - Determines whether this goal is active.
  *   `created` (*type:* `DateTime.t`, *default:* `nil`) - Time this goal was created.
  *   `eventDetails` (*type:* `GoogleApi.Analytics.V3.Model.GoalEventDetails.t`, *default:* `nil`) - Details for the goal of the type EVENT.
  *   `id` (*type:* `String.t`, *default:* `nil`) - Goal ID.
  *   `internalWebPropertyId` (*type:* `String.t`, *default:* `nil`) - Internal ID for the web property to which this goal belongs.
  *   `kind` (*type:* `String.t`, *default:* `analytics#goal`) - Resource type for an Analytics goal.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Goal name.
  *   `parentLink` (*type:* `GoogleApi.Analytics.V3.Model.GoalParentLink.t`, *default:* `nil`) - Parent link for a goal. Points to the view (profile) to which this goal belongs.
  *   `profileId` (*type:* `String.t`, *default:* `nil`) - View (Profile) ID to which this goal belongs.
  *   `selfLink` (*type:* `String.t`, *default:* `nil`) - Link for this goal.
  *   `type` (*type:* `String.t`, *default:* `nil`) - Goal type. Possible values are URL_DESTINATION, VISIT_TIME_ON_SITE, VISIT_NUM_PAGES, AND EVENT.
  *   `updated` (*type:* `DateTime.t`, *default:* `nil`) - Time this goal was last modified.
  *   `urlDestinationDetails` (*type:* `GoogleApi.Analytics.V3.Model.GoalUrlDestinationDetails.t`, *default:* `nil`) - Details for the goal of the type URL_DESTINATION.
  *   `value` (*type:* `number()`, *default:* `nil`) - Goal value.
  *   `visitNumPagesDetails` (*type:* `GoogleApi.Analytics.V3.Model.GoalVisitNumPagesDetails.t`, *default:* `nil`) - Details for the goal of the type VISIT_NUM_PAGES.
  *   `visitTimeOnSiteDetails` (*type:* `GoogleApi.Analytics.V3.Model.GoalVisitTimeOnSiteDetails.t`, *default:* `nil`) - Details for the goal of the type VISIT_TIME_ON_SITE.
  *   `webPropertyId` (*type:* `String.t`, *default:* `nil`) - Web property ID to which this goal belongs. The web property ID is of the form UA-XXXXX-YY.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :accountId => String.t() | nil,
          :active => boolean() | nil,
          :created => DateTime.t() | nil,
          :eventDetails => GoogleApi.Analytics.V3.Model.GoalEventDetails.t() | nil,
          :id => String.t() | nil,
          :internalWebPropertyId => String.t() | nil,
          :kind => String.t() | nil,
          :name => String.t() | nil,
          :parentLink => GoogleApi.Analytics.V3.Model.GoalParentLink.t() | nil,
          :profileId => String.t() | nil,
          :selfLink => String.t() | nil,
          :type => String.t() | nil,
          :updated => DateTime.t() | nil,
          :urlDestinationDetails =>
            GoogleApi.Analytics.V3.Model.GoalUrlDestinationDetails.t() | nil,
          :value => number() | nil,
          :visitNumPagesDetails =>
            GoogleApi.Analytics.V3.Model.GoalVisitNumPagesDetails.t() | nil,
          :visitTimeOnSiteDetails =>
            GoogleApi.Analytics.V3.Model.GoalVisitTimeOnSiteDetails.t() | nil,
          :webPropertyId => String.t() | nil
        }

  field(:accountId)
  field(:active)
  field(:created, as: DateTime)
  field(:eventDetails, as: GoogleApi.Analytics.V3.Model.GoalEventDetails)
  field(:id)
  field(:internalWebPropertyId)
  field(:kind)
  field(:name)
  field(:parentLink, as: GoogleApi.Analytics.V3.Model.GoalParentLink)
  field(:profileId)
  field(:selfLink)
  field(:type)
  field(:updated, as: DateTime)
  field(:urlDestinationDetails, as: GoogleApi.Analytics.V3.Model.GoalUrlDestinationDetails)
  field(:value)
  field(:visitNumPagesDetails, as: GoogleApi.Analytics.V3.Model.GoalVisitNumPagesDetails)
  field(:visitTimeOnSiteDetails, as: GoogleApi.Analytics.V3.Model.GoalVisitTimeOnSiteDetails)
  field(:webPropertyId)
end

defimpl Poison.Decoder, for: GoogleApi.Analytics.V3.Model.Goal do
  def decode(value, options) do
    GoogleApi.Analytics.V3.Model.Goal.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Analytics.V3.Model.Goal do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
